﻿@using System.Web.Mvc;

<div class="user-display" style="position:relative;">
    @if (WorkContext.CurrentUser != null) {
        <span class="user-actions welcome">
            @T("Welcome, <strong>{0}</strong>!", new HtmlString(Html.ActionLink( WorkContext.CurrentUser.UserName, "ChangePassword", new { Controller = "Account", Area = "Orchard.Users" }).ToString()))
        </span>
        <span class="user-actions">
            @Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }, new { rel = "nofollow" })
            @if (AuthorizedFor(Orchard.Security.StandardPermissions.AccessAdminPanel)) {
                @Html.ActionLink(T("Dashboard").ToString(), "Index", new {Area = "Dashboard", Controller = "Admin"})
            }
        </span>
    } else {
        <span class="sign-in"><a href="#sign-in">@T("Sign In")</a>@* @Html.ActionLink(T("Sign In").ToString(), "LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = (Request.QueryString["ReturnUrl"] ?? Request.RawUrl) }, new { rel = "nofollow" })*@</span>
    }
    <div class="header_login" style="display: none;">
        <div class="block block-login header_login_box">
            <button class="login_close" id="removeClass"></button>
            @using (Html.BeginFormAntiForgeryPost(Url.Action("LogOn", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = (Request.QueryString["ReturnUrl"] ?? Request.RawUrl) })))
            {
                <div class="block-content">
                    <label for="username-email">@T("User/Email"):</label>
                    @Html.TextBox("userNameOrEmail", "", new { id = "username-email", autofocus = "autofocus" })
                    <label for="password">@T("Password")</label>
                    @Html.Password("password")
                    <div class="actions">
                    <div class="login_pan_box">
                        @Html.ActionLink(T("Forgot Password?").Text, "RequestLostPassword", "Account", new { area = "Orchard.Users" }, new { @class = "forget_link" })
                        <button type="submit">@T("Login")</button>
                    </div>
                    <div class="create_pan">
                        @Html.ActionLink(T("Create an Account").Text, "Register","Account", new { area = "Orchard.Users" }, new {@class="button" })
                    </div>
                    </div>
                </div>
            }
        </div>
    </div>
</div>
@using (Script.Foot())
{ 
    <script type="text/javascript">
        $(function () {
            $('.sign-in a').click(function () {
                $('.header_login').show();
                $(this).addClass('active');
            });
            $('.login_close').click(function () {
                $('.header_login').hide();
                $('.sign-in a').removeClass('active');
            });
        });
    </script>
}